$layout-background: #f0f2f5;

$layout-header-height: x-space(8);
$layout-header-background: linear-gradient(to right, #5C93FE, #29CBFD);
$layout-header-z-index: 99;
$layout-header-logo-size: x-space(4);
$layout-header-title-color: $color-gray-1;
$layout-header-menu-item-color: $color-gray-1;

$layout-sider-width: x-space(30);
$layout-sider-background: $color-gray-1;
$layout-sider-z-index: 98;
$layout-sider-nav-item-text-color-active: $color-gray-1;
$layout-sider-nav-item-text-background-active: linear-gradient(to right, #5C93FE, #29CBFD);

$layout-content-background: $color-gray-1;

.layout {
  position: relative;
  min-height: 100vh;
  z-index: 1;
  background: $layout-background;
  overflow-x: hidden;

  &-header {
    position: fixed;
    width: 100%;
    height: $layout-header-height;
    top: 0;
    left: 0;
    background: $layout-header-background;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.35);
    z-index: $layout-header-z-index;

    &-logo {
      width: auto;
      height: inherit;
      float: left;
      overflow: hidden;

      & > a {
        display: flex;
        height: 100%;
        flex-direction: row;
        align-items: center;
        text-decoration: none;

        img {
          flex: 0 0 $layout-header-logo-size;
          width: $layout-header-logo-size;
          height: $layout-header-logo-size;
          margin: 0 $layout-header-logo-size/2;
        }

        h1 {
          flex: auto;
          margin: 0;
          color: $layout-header-title-color;
          font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
          font-size: 20px;
          font-weight: 500;
          text-transform: uppercase;
        }
      }
    }

    &-menu-right {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      width: auto;
      height: inherit;
      float: right;
      padding-right: x-space(1);

      .menu-item {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        padding: 0 x-space(1);
        text-decoration: none;
        color: $layout-header-menu-item-color;

        &:hover {
          color: $layout-header-menu-item-color;
        }

        & > .menu-icon {
          font-size: 18px;
          margin-right: x-space(1);
        }

        &-user {
          display: inline-flex;
          height: 100%;
          cursor: pointer;

          &-dropdown-btn {
            height: 100%;
            display: inline-flex;
            flex-direction: row;
            align-items: center;

            img {
              width: x-space(3);
              height: x-space(3);
              border-radius: 50%;
              overflow: hidden;
            }

            span {
              margin-left: x-space();
              line-height: x-space(3);
            }
          }
        }
      }
    }

    &-avatar-dropdown.el-dropdown-menu {
      min-width: x-space(20);
      margin-top: x-space(1) !important;

      .el-dropdown-menu__item {

        a {
          display: block;
          color: $color-primary-text;
          text-decoration: none;

          .x-icon,
          span {
            display: inline-block;
            vertical-align: middle;
          }

          .x-icon {
            font-size: 16px;
          }

          span {
            margin-left: x-space();
          }
        }

        &:hover {
          color: $color-primary-text !important;
        }
      }
    }
  }

  &-sider {
    position: fixed;
    width: $layout-sider-width;
    height: 100%;
    padding-top: $layout-header-height + x-space(1);
    padding-bottom: x-space(1);
    top: 0;
    left: 0;
    z-index: $layout-sider-z-index;
    background-color: $layout-sider-background;

    &-wrap {
      height: 100%;

      .el-menu {
        border: none;
        width: 100% !important;

        .el-menu-item,
        .el-submenu__title {
          height: 48px;
          line-height: 45px;

          .svg-icon,
          .class-icon,
          .image-icon {
            display: inline-block;
            width: 24px;
            height: 19px;
            margin-right: 5px;
            font-size: 18px;
            line-height: 19px;
            text-align: center;
          }

          .image-icon {
            background-size: 18px 18px;
          }

          [class^=el-icon-] {
            height: 19px;
          }
        }

        @mixin el-menu-item-active-common {
          color: $color-primary;
          & > i,
          & .el-tooltip > i {
            color: $color-primary;
          }
        }

        .el-menu-item {
          & > a {
            display: block;
            text-decoration: none;
          }

          &:hover,
          &:focus,
          &.is-active {
            & > a {
              @include el-menu-item-active-common;
            }
          }

          &.is-active {
            color: $layout-sider-nav-item-text-color-active;
            background: $layout-sider-nav-item-text-background-active !important;
          }
        }

        .el-submenu {
          .el-submenu__title {
            &:hover,
            &:focus {
              @include el-menu-item-active-common;
            }
          }

          &.is-opened,
          &.is-active {
            & > .el-submenu__title {
              @include el-menu-item-active-common;
            }
          }
        }
      }
    }
  }

  &-main {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100vh;
    padding-top: $layout-header-height;
    padding-left: $layout-sider-width;
    display: flex;
    flex-direction: column;

    .layout-breadcrumb {
      flex: 0 0 auto;
      padding: x-space(2) x-space(4);

      .breadcrumb-index {
        font-weight: bolder;
        margin-right: x-space(1);

        i {
          display: none;
        }
      }
    }

    .layout-content {
      flex: auto;
      margin-left: x-space(4);
      background-color: $layout-content-background;
      padding: x-space(3);
    }
  }
}